import { apiClient } from './client';
import type { MemberInfo, UpdateEmailRequest, UpdatePasswordRequest, UpdateFundPasswordRequest } from '../types/user';
import { API_ENDPOINTS } from './config';

export const userApi = {
    // Get user profile information
    getMemberInfo: async (): Promise<MemberInfo> => {
        return apiClient.get(API_ENDPOINTS.MEMBER_INFO);
    },

    // Update user email
    updateEmail: async (data: UpdateEmailRequest): Promise<void> => {
        return apiClient.post(API_ENDPOINTS.UPDATE_EMAIL, data);
    },

    // Update login password
    updatePassword: async (data: UpdatePasswordRequest): Promise<void> => {
        return apiClient.post(API_ENDPOINTS.UPDATE_PASSWORD, data);
    },

    // Update fund password
    updateFundPassword: async (data: UpdateFundPasswordRequest): Promise<void> => {
        return apiClient.post(API_ENDPOINTS.UPDATE_FUND_PASSWORD, data);
    },
};